<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); ?>

<html>
    <title><?php echo $title; ?></title>
    <link href="<?php echo base_url(); ?>asset/admin/css/style.css" rel="stylesheet" type="text/css" />
    <body>
        <div id="header"><h2>MY WEB APPLICATION</h2></div>
        <div id="content">
            <?php
            if ($this->auth->is_logged_in() == true):
                //-------------------------------------
                //	 PINDAHAN DARI VIEW INDEX.PHP
                //-------------------------------------
                // level untuk user ini
                $level = $this->session->userdata('level');
                // ambil menu dari database sesuai dengan level
                $menu = $this->usermodel->get_menu_for_level($level);
                ?>
                <div id="header-bar">
                    Welcome, <?php echo $this->session->userdata('nama'); ?>, <?php echo anchor('home/logout', 'Logout'); ?>
                </div>
                <div id="sidebar-menu">
                    <ul class="menu">
                        <?php
                        foreach ($menu->result() as $row) {
                            echo '<li>' . anchor($row->menu_uri, $row->menu_nama) . '</li>';
                        }
                        ?>
                    </ul>
                </div>
                <?php
            //--------------------------------------
            // 	END PINDAHAN
            //--------------------------------------
            endif;
            ?>

            <?php
            // dynamic content loaded here
            echo $contents;
            ?>

            <div class="clear"></div>
        </div>
        <div id="footer">Copyright &copy; anggytrisnawan.com</div>
    </body>
</html>